﻿using System;
using System.ComponentModel.DataAnnotations;
using VisionCloud.Utility;

namespace VisionCloud.Domain.DtoModel.Sys
{
    public class SysDeviceDto
    {

        public Guid DeviceGuid { get; set; }

        /// <summary>
        /// 设备软件版本号
        /// </summary>
        public string DeviceSoftwareVersion { get; set; }

        /// <summary>
        /// 设备编号
        /// </summary>
        public string DeviceNumber { get; set; }

        /// <summary>
        /// 设备分配人员Id
        /// </summary>
        public Guid DeviceUserId { get; set; }

        private string deviceUserName;

        /// <summary>
        /// 设备分配人员
        /// </summary>
        public string DeviceUserName
        {
            get
            {
                if (!string.IsNullOrEmpty(deviceUserName))
                {
                    return deviceUserName;
                }
                else
                {
                    return string.Empty;
                }
            }
            set { deviceUserName = value; }
        }

        /// <summary>
        /// 计算机编号
        /// </summary>
        public string ComputerNumber { get; set; }

        /// <summary>
        /// 计算机系统版本
        /// </summary>
        public string ComputerSystemVersion { get; set; }

        /// <summary>
        /// 计算机类型
        /// </summary>
        public string ComputerType { get; set; }

        /// <summary>
        /// 计算机出厂日期
        /// </summary>
        public DateTime? ComputerDateOfProduction { get; set; }

        /// <summary>
        /// 扫描仪编号
        /// </summary>
        public string ScannerNumber { get; set; }

        /// <summary>
        /// 扫描仪类型
        /// </summary>
        public string ScannerType { get; set; }

        /// <summary>
        /// 扫描仪出厂日期
        /// </summary>
        public DateTime ScannerDateOfProduction { get; set; }

        /// <summary>
        /// 扫描仪固件版本
        /// </summary>
        public string ScannerFirmwareVersion { get; set; }

        /// <summary>
        /// 是否激活
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 是否已经激活界面显示
        /// </summary>
        public string IsActiveStr
        {
            get
            {
                return IsActive ? StartupServer.ServiceLocalizer["YB0442"] : StartupServer.ServiceLocalizer["YB0443"];
            }
        }

        /// <summary>
        /// 激活日期
        /// </summary>
        public DateTime? ActiveDate { get; set; }

        /// <summary>
        /// 激活人员
        /// </summary>
        public Guid? ActiveUserGuid { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        public string CustomerCompanyName { get; set; }

        /// <summary>
        /// 计算机保修期
        /// </summary>
        public int? ComputerExpire { get; set; }

        /// <summary>
        /// 扫描仪保修期
        /// </summary>
        public int? ScannerExpire { get; set; }

        /// <summary>
        /// 设备整机保修期
        /// </summary>
        public int? DeviceExpire { get; set; }

        /// <summary>
        /// 加密狗设备号
        /// </summary>
        public string EncryptedDogNumber { get; set; }

        /// <summary>
        /// 加密狗类型
        /// </summary>
        public string EncryptedDogType { get; set; }

        /// <summary>
        /// 对应设备唯一标识：DeviceIdentification
        /// </summary>
        public string Mac { set; get; }

        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime CreatedDate { get; set; }

        public bool IsDelete { get; set; }

        /// <summary>
        /// 设备出厂日期
        /// </summary>
        public DateTime? DeviceDateOfProduction { get; set; }

        /// <summary>
        /// 设备出厂日期显示字段
        /// </summary>
        public string DeviceDateOfProductionStr
        {
            get
            {
                return DeviceDateOfProduction.HasValue ? DeviceDateOfProduction.Value.ToShortDateString() : "";
            }
        }

        /// <summary>
        /// 三脚架保修期
        /// </summary>
        public int? TripodExpire { get; set; }

        /// <summary>
        /// 客户联系方式
        /// </summary>
        public string CustomerPhoneNumber { get; set; }

        /// <summary>
        /// 三脚架类型
        /// </summary>
        public string TripodType { get; set; }

        public DateTime LastUpdatedDate { get; set; }

        public string DeviceNO { get; set; }
    }

    /// <summary>
    /// 作者：黄钧航
    /// 提供外部API调用，不要随意扩展字段
    /// </summary>
    public class SysDeviceDtoPart
    {
        public Guid DeviceGuid { get; set; }

        /// <summary>
        /// 设备软件版本号
        /// </summary>
        public string DeviceSoftwareVersion { get; set; }

        /// <summary>
        /// 设备编号
        /// </summary>
        public string DeviceNumber { get; set; }

        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime CreatedDate { get; set; }
    }

    /// <summary>
    /// 设备请求查询
    /// </summary>
    public class DeviceCondtion
    {
        /// <summary>
        /// 设备Id
        /// </summary>
        public Guid DeviceGuid { get; set; }
        /// <summary>
        /// 扫描仪类型
        /// </summary>
        public string ScannerType { get; set; }
        /// <summary>
        /// 扫描仪序列号
        /// </summary>
        [Required]
        public string ScannerNumber { get; set; }
    }
}